package LeetCode.NumOffer;

public class NumOffer54 {
    public class TreeNode {
        int val;
        TreeNode left;
        TreeNode right;
        TreeNode(int x) { val = x; }
 }
//    public static int kthLargest(TreeNode root, int k) {
//
//    }
    public static int maxNode(TreeNode root){
        if(root == null){
            return 0;
        }
        if(root.left == null){
            return root.right.val;
        }
        if(root.right == null){
            return root.left.val;
        }
        if(root.right == null && root.left == null){
            return root.val;
        }
        return maxNode(root.right);
    }
}
